package KK.net
{ 
	import KK.System.Pool.IPool;
	import KK.System.Pool.IPoolManager;
	import KK.System.Pool.PoolManager;
	
	import mx.core.Singleton;
	
	public class LoaderManager
	{
		private var SwfPool:IPoolManager;
		private var DataPool:IPoolManager;
		
		private static  var instance:LoaderManager;
		
		public function LoaderManager(singleton:Singleton)
		{
			//TODO: implement function
			if(instance){
				throw new Error("this singleton class , pless using Instance function Get Instance");
			}
			instance=this;

			init();
		}
		private function init():void{
			SwfPool=new PoolManager(Q_SwfLoader);
			DataPool=new PoolManager(Q_Loader);
		}

		/**
		 * 创建资源加载器  
		 * @return 
		 * 
		 */
		public static function get SwfLoader():Q_SwfLoader{
			return Instance.SwfPool.Creater() as Q_SwfLoader;
		}
		
		/**
		 * 创建数据加载器 
		 * @return 
		 * 
		 */
		public static  function get Loader():Q_Loader{
			return Instance.DataPool.Creater() as Q_Loader;
		}
		/**
		 * 获取单例 
		 * @return 
		 * 
		 */
		public static function get Instance():LoaderManager{
			if(!instance){
				new LoaderManager(new Singleton);
			}
			return instance;
		}
	}
}


class Singleton{
	
}